* Replication code for Aarøe, Petersen and Arceneaux (2017) US Sample 5 *

* This do file reproduces analyses related to the US Sample 5
* Use the following replication data set: "Replication Data Set US Sample 5"
** See the Online Appendix for details on question wording and survey flow

set more off

******************************************************************************************************
* recodings and reliability code reported here
******************************************************************************************************

* Creation of the Pathogen Disgust Scale (ranging from 0 to 1)
egen pathogen=rmean( q24_1 q24_2 q24_3 q24_4 q24_5 q24_6 q24_7)
gen pathogen01 =(pathogen-1)/6

* Crohnbachs' alpha reliability coefficient for the pathogen disgust scale (reported in Online Appendix A13)
alpha  q24_1 q24_2 q24_3 q24_4 q24_5 q24_6 q24_7

* Summary statistics for the Pathogen Disgust Scale (reported in text in online Appendix A13)
sum pathogen01


* Creation of the scale measuring social conservatism (ranging from 0 to 1, higher values more conservative)
recode  q16_1 q16_5 q16_11 q16_14 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1), gen (q16_1rq q16_5rq q16_11rq q16_14rq)

egen USsocialissues=rmean(q16_1rq q16_5rq q16_11rq q16_12 q16_13 q16_14rq q16_15 q16_16 q16_17)
gen USsocialissues01=(USsocialissues-1)/6

* Crohnbachs' alpha reliability coefficient for measuring social conservatism (reported in text in online Appendix A13)
alpha q16_1rq q16_5rq q16_11rq q16_12 q16_13 q16_14rq q16_15 q16_16 q16_17 


* Creation of the scale measuring economic conservatism (ranging from 0 to 1, higher values more conservative)
recode  q16_2 q16_4 q16_8 q16_9 q16_10 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1), gen (q16_2rq q16_4rq q16_8rq q16_9rq q16_10rq)

egen USeconissues=rmean(q16_2rq q16_3 q16_4rq q16_6 q16_7 q16_8rq q16_9rq q16_10rq q16_18) 
gen USeconissues01=(USeconissues-1)/6

* Crohnbachs' alpha reliability coefficient for measuring economic conservatism (reported in text in online Appendix A13)
alpha q16_2rq q16_3 q16_4rq q16_6 q16_7 q16_8rq q16_9rq q16_10rq q16_18


* ideology coded in three categories (for Figure 3 in the main text and Online Appendix A18)
gen ideo3=q19 
recode ideo3 (1=1) (2=1) (3=1) (4=2) (5=3) (6=3) (7=3)
ta ideo3
label define ideo3 1 "Liberals" 2 "Middle of the road" 3 "Conservatives"
label values ideo3 ideo3

* Ideology coded on a 7-point scale ranging from 0 to 1, higher values more conservative (used in the analyses summarized in footnote 10 in Online Appendix A14)
gen lib_con= q19
gen lib_con01 =(lib_con-1)/6
ta lib_con01

*race
gen nonwhite=race
recode nonwhite (1=0) (2=1) (3=1) (4=1) (5=1) (6=1) (7=1)
label define nonwhite 1 "nonwhite" 0 "Caucasian/white"
label values nonwhite nonwhite

*income ranging from 0 to 1
** As explained in footnote 9 in Online Appendix A13, by mistake two respondents appear in a category "$150,000 or more" on the income measure ///
** This is inconsistent with the consecutive income intervals on the scale; because these two respondents cannot be situated with sufficient precision in the///
**other income intervals, these two answers were excluded (the recode of respondents with the value "31")
recode faminc (97=.) (31=.), gen (income)
ta income
gen income01 = (income-1)/15

*gender (1 = female)
gen female = gender
recode female (2=1) (1=0)

*education ranging from 0 to 1
ta educ
gen edu01 =(educ-1)/5
ta edu01

* age
sum age

* Big five personality traits ranging from 0 to 1
* Openess, higher values more open
alpha q40a q40b, gen(openess)
replace openess = (10-openess)/10
ta openess
cor q40a q40b

* Conscientiousness, higher values more conscientious 
alpha q40c q40d, gen(consci)
replace consci = (10-consci)/10
ta consci
cor q40c q40d

* Extraversion, higher values more extraverted 
alpha q40e q40f, gen(extraversion)
replace extraversion = (10-extraversion)/10
ta extraversion
cor q40e q40f

* Agreeableness, higher values more agreeable 
alpha q40g q40h, gen(agreeableness)
replace agreeableness = (10-agreeableness)/10
ta agreeableness
cor q40g q40h

* Neuroticism, higher values more neurotic 
alpha q40i q40j, gen(neuroticism)
replace neuroticism=(neuroticism/10)
cor q40i q40j


**************************************************************************************************
* Analyses reported in the conclusion in the main text in the section "Discussion and conclusion"
**************************************************************************************************

* Results reported in the main text

* Figure 3 Marginal effect of pathogen disgust sensitivity on soial and economic conservatism by ideological self-identificationreg USeconissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion ///
* Figure 3, Panel A Social Conservatism
set level 90, permanently

reg USsocialissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion ///
agreeableness neuroticism if ideo3 ==1
margins, dydx(pathogen01) level(90)
estimates store m2
reg USsocialissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion ///
agreeableness neuroticism if ideo3 ==2
margins, dydx(pathogen01) level(90)
estimates store m3
reg USsocialissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion ///
 agreeableness neuroticism if ideo3 ==3
margins, dydx(pathogen01) level(90)
estimates store m4		
coefplot (m2, keep("pathogen01")) (m3, keep("pathogen01")) (m4, keep("pathogen01")), ///
recast(bar) barw(.20) ciopts(recast(rcap) lpattern(dash) lcolor(black)) msize(medlarge) vertical yscale(range(-.15 .15)) ylabel(-.15(.05).15, nogrid) yline(0, lstyle(foreground)) xlabel(none) ytitle("Effect of Pathogen Disgust") title("Panel A. Social Conservatism") legend (order(2 4 6) label(2 "Liberals") label(4 "Middle of the road") label(6 "Conservatives") col(1)) scheme(s2mono) graphregion(lcolor(black) fcolor(white)) 
graph display, ysize(3) xsize(2.5)

* Figure 3, Panel B Economic Conservatism
reg USeconissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion ///
agreeableness neuroticism if ideo3 ==1
margins, dydx(pathogen01) level(90)
estimates store m2
reg USeconissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion ///
agreeableness neuroticism if ideo3 ==2
margins, dydx(pathogen01) level(90)
estimates store m3
reg USeconissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion ///
agreeableness neuroticism if ideo3 ==3
margins, dydx(pathogen01) level(90)
estimates store m4
coefplot (m2, keep("pathogen01")) (m3, keep("pathogen01")) (m4, keep("pathogen01")), ///
recast(bar) barw(.20) ciopts(recast(rcap) lpattern(dash) lcolor(black)) msize(medlarge) vertical yscale(range(-.15 .15)) ylabel(-.15(.05).15, nogrid) yline(0, lstyle(foreground)) xlabel(none) ytitle("Effect of Pathogen Disgust") title("Panel B. Economic Conservatism") legend (order(2 4 6) label(2 "Liberals") label(4 "Middle of the road") label(6 "Conservatives") col(1)) scheme(s2mono) graphregion(lcolor(black) fcolor(white))
graph display, ysize(3) xsize(2.5)

set level 95, permanently

* Results reported in the Online Appendix

* Online Appendix A14, Table A18 The moderating effect of overall ideological self-identification on the effect of pathogen disgust on social and economic conservatism
* Models 1-2
eststo clear
eststo: reg USsocialissues01 c.pathogen01##i.ideo3 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism, robust
eststo: reg USeconissues01 c.pathogen01##i.ideo3 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism, robust
*Model 3 - among liberals, DV = social conservatism
eststo: reg USsocialissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism if ideo3 ==1
*Model 4 - middle of the road, DV = social conservatism
eststo: reg USsocialissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism if ideo3 ==2
*Model 5 - among conservatives, DV = social conservatism
eststo: reg USsocialissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism if ideo3 ==3

*Model 6 - among liberals, DV = economic conservatism
eststo: reg USeconissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism if ideo3 ==1
*Model 7 - middle of the road, DV = economic conservatism
eststo: reg USeconissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism if ideo3 ==2
*Model 8 - among conservatives, DV = economic conservatism
eststo: reg USeconissues01 pathogen01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism if ideo3 ==3
esttab, b(%5.2f) se(%5.2f), using part_2.rtf, replace onecell star(* 0.1 ** 0.02 *** 0.002) wide constant ar2
eststo clear

* Online Appendix A14 -replication analysis using the full interval ideology variable - footnote text
eststo: reg USsocialissues01 c.pathogen01##c.lib_con01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism, robust
eststo: reg USeconissues01 c.pathogen01##c.lib_con01 female age edu01 income01 nonwhite openess consci extraversion agreeableness neuroticism, robust



